<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Timeline extends Model
{
    //
    protected $guarded = [];

    /*
     * type代表行为的类型
     *
     * type=1 代表做题   {task:{}}//ok
     * type=2 贡献题目		//ok
     * type=3 对学习资料点赞
     * type=4 回复学习资料
     * type=5 撰写学习资料   //ok
     * type=6 获得勋章      //
     */
    public static function createTimeline($userid, $type, $content, $time = 0)
    {
        $data = array();
        $data['userid'] = $userid;
        $data['type'] = $type;
        $data['content'] = json_encode($content);
        $data['timestamp'] = $time;
        TimeLine::create($data);
    }
}
